<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\industrytype\model;

class Type extends \app\BaseModel
{
    protected $name = "massage_industry_type";
    public function dataAdd($data)
    {
        $data["create_time"] = time();
        $res = $this->insert($data);
        return $res;
    }
    public function initData($uniacid)
    {
        $arr = [["uniacid" => $uniacid, "title" => "按摩师", "type" => 1, "business_license" => 0, "health_certificate" => 0, "massage_certificate" => 1, "id_card" => 1, "avatar_verification" => 1, "door_service" => 1, "store_service" => 1, "birthday" => 1, "employment_years" => 1, "qualification" => 1, "age_sex" => 0], ["uniacid" => $uniacid, "title" => "陪玩官", "type" => 2, "business_license" => 0, "constellation" => 1, "health_certificate" => 0, "massage_certificate" => 0, "id_card" => 1, "avatar_verification" => 1, "door_service" => 1, "store_service" => 1, "height" => 1, "weight" => 1, "birthday" => 1, "qualification" => 0, "age_sex" => 1]];
        $key = "industry_type_key";
        incCache($key, 1, $uniacid, 3);
        if(getCache($key, $uniacid) == 1) {
            foreach ($arr as $value) {
                $dis = ["uniacid" => $uniacid, "type" => $value["type"]];
                $find = $this->dataInfo($dis);
                if(empty($find)) {
                    $this->dataAdd($value);
                }
            }
        }
        decCache($key, 1, $uniacid);
        return true;
    }
    public function dataUpdate($dis, $data)
    {
        $res = $this->where($dis)->update($data);
        return $res;
    }
    public function dataList($dis, $page)
    {
        $data = $this->where($dis)->order("top desc,id desc")->paginate($page)->toArray();
        return $data;
    }
    public function dataInfo($dis, $filed = "*")
    {
        $data = $this->where($dis)->field($filed)->find();
        return !empty($data) ? $data->toArray() : [];
    }
    public function dataSelect($where, $filed = "*")
    {
        return $this->where($where)->column($filed, "id");
    }
}

?>